package ro.unibuc.nautilus.controllers.editors;

import java.beans.PropertyEditorSupport;

import org.springframework.beans.factory.annotation.Required;

import ro.unibuc.nautilus.service.HarboursService;

public class HarbourPropertyEditor extends PropertyEditorSupport {
	private HarboursService harboursService;

	@Override
    public void setAsText(String text) throws IllegalArgumentException {
        Long harbourId = new Long(text);
        setValue(harboursService.findHarbour(harbourId));
    }
	
	@Required
	public void setHarboursService(HarboursService harboursService) {
		this.harboursService = harboursService;
	}

}
